<?php
// 面包屑
$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'订单管理'=>array($this->pre_module_url.'/orderSale/saleorder'),
	'发货管理'=>array($this->pre_module_url.'/orderSale/Delivery')
);

//我的地址
$address = MemAddres::model()->getCmpAddress();//print_r($address);
$model->zo_trx_addid = $address['trx']->zma_id;
$model->zo_sent_addid = $address['sent']->zma_id;

//修改地址弹框内容
$str = '<form  method="post" action=""><div class="updtitle field" style="width:620px;"><ul class="form_list address" style="padding-left:10px;">';
foreach($address['all'] as $val){
$str .=	'<li><input class="chk cmpaddress" name="address" value="'.$val->zma_id.'" type="radio" /><span> '.$val->zma_address.'，'.$val->zma_email.'，'.$val->zma_name.'，'.$val->zma_mob.'，'.$val->zma_tel.'</span></li>';
}
$str .=	'</ul></div></form>';

?>
<div class="deliver_box">     	
<!--第一步 start-->
<div class="box step_one">
	<div class="hd"><span class="c_f60 step">第一步</span>确认收货信息及交易详情</div>
	<div class="bd">
		<div class="order_hd"><span class="mr30">订单编号：<?php echo $model->zo_id;?></span><span>成交时间：<?php echo CHtml::encode(date('Y-m-d H:m:s', $model->zo_create_time)); ?></span></div>
		<div class="order_bd c_f list_table">
		<?php foreach($model->orderProduct as $product ){?>
			<div class="list_table2 ">
			<div class="pro pub">
				<div class="c_img c_img50">
					<?php echo CHtml::link(Tool::thumb($product->zop_pic,50,50),array('/home/product/detail',array('id'=>$product->zp_id)),array('class'=>'c_06c'))?>
				</div>
				<div class="info_r f_l">
					<p class="title_pro line_18">
						<?php echo CHtml::link(mb_substr($product->zop_title,0,16,'utf8'),array('/home/product/detail',array('id'=>$product->zp_id)),array('class'=>'c_06c'))?>
					</p>
					<?php foreach((array)unserialize($product->zop_spe) as $key=>$val){?>
					<p class="c_999"><?php echo $key ?>：<?php echo $val?></p>
					<?php } ?>
					<p class="c_999">商家编号：<?php echo $product->zpa_pro_no?></p>
				</div>
			</div>
			<div class="price pub t_c"><?php echo $product->zop_price?>x<?php echo $product->zop_nums?></div>
			</div>
		<?php } ?>
			<div class="wuliu pub t_c">买家选择：<?php if(!empty($model->express)) echo $model->express->ze_title?></div>
		</div>
		<div class="address_info c_f">
			<!-- <a class="c_06c f_r" onclick="return updateaddress();" href="javascript:" title="">修改收货信息</a> -->
			<p>买家收货信息：<?php echo $model->zo_address; //地址 ?>，
							<?php echo $model->zo_email;  //邮箱 ?>，
							<?php echo $model->zo_name ; //联系人 ?>，
							<?php echo $model->zo_address; //固定电话 ?>，
							<?php echo $model->zo_telphone; //手机号码?>
			</p>
		</div>
	</div>
</div>
<!--第一步 end-->
<!--第二步 start-->
<div class="box step_two">
	<div class="hd"><span class="c_f60 step">第二步</span>确认收货/退货信息</div>
	<div class="bd">
		<div class="address_info c_f">
			<a class="c_06c f_r" onclick="return changeAddress('trx');" href="javascript:" title="">修改我的发货信息</a>
			<p id="address_trx">我的发货信息：<?php /*$area = Area::model()->getFullAreaByFloorId($address['trx']->zar_id);
								if(isset($area['area3'])) echo $area['area3']['zar_title'];
								if(isset($area['area2'])) echo $area['area2']['zar_title'];
								if(isset($area['area1'])) echo $area['area1']['zar_title'];*/
							?>
							<?php echo $address['trx']->zma_address; //地址 ?>，
							<?php echo $address['trx']->zma_email;  //邮箱 ?>，
							<?php echo $address['trx']->zma_name ; //联系人 ?>，
							<?php echo $address['trx']->zma_mob; //固定电话 ?>，
							<?php echo $address['trx']->zma_tel; //手机号码?>
			</p>
		</div>
		<div class="address_info c_f">
			<a class="c_06c f_r" onclick="return changeAddress('sent');" href="javascript:" title="">修改我的退货信息</a>
			<p id="address_sent">我的退货信息：<?php /*$area = Area::model()->getFullAreaByFloorId($address['sent']->zar_id);
								if(isset($area['area3'])) echo $area['area3']['zar_title'];
								if(isset($area['area2'])) echo $area['area2']['zar_title'];
								if(isset($area['area1'])) echo $area['area1']['zar_title'];*/
							?>
							<?php echo $address['sent']->zma_address; //地址 ?>，
							<?php echo $address['sent']->zma_email;  //邮箱 ?>，
							<?php echo $address['sent']->zma_name ; //联系人 ?>，
							<?php echo $address['sent']->zma_mob; //固定电话 ?>，
							<?php echo $address['sent']->zma_tel; //手机号码?>
			</p>
		</div>
	</div>
</div>
<!--第二步 end-->
<!--第三步 start-->
<div class="box step_three">
	<div class="hd"><span class="c_f60 step">第三步</span>选择物流</div>
	<div class="bd">
		<div class="pub_tab min_pub_tab" id="tabAds">
			<div class="tab_hd2">
				<ul class="c_f">
					<li><a href="javascript:">需要物流<b class="mem_bgx left"></b><b class="mem_bgx right"></b></a></li>
					<li><a href="javascript:">无需物流<b class="mem_bgx left"></b><b class="mem_bgx right"></b></a></li>
				</ul>
			</div>
			<div class="tab_cont2">
				<?php $form=$this->beginWidget('CActiveForm', array(
					'id'=>'order-form1',
					'enableAjaxValidation'=>false,
				)); ?>
					<?php echo $form->hiddenField($model,'zo_id')?>
					<?php echo $form->hiddenField($model,'zo_trx_addid',array('class'=>'trx_address'))?>
					<?php echo $form->hiddenField($model,'zo_sent_addid',array('class'=>'sent_address'))?>
					<ul class="form_list">
						<li><span class="tit">物流公司：</span>
							<?php echo $form->dropDownList($model,'zo_express_com',Express::model()->getExpressCom(),array('class'=>'s_ipt','empty'=>'选择物流公司'))?>
							<span id="Order_zo_express_comTip"></span>
						</li>
						<li><span class="tit">运单号码：</span>
							<?php echo $form->textField($model,'zo_express_id',array('class'=>'t_ipt ipt_bg','maxlength'=>'50'))?>
							<span id="Order_zo_express_idTip"></span>
						</li>
						<li><span class="tit">备注：</span>
							<?php echo $form->textArea($model,'zo_note',array('class'=>'t_area'))?>
						</li>
						<li><span class="tit"></span>
							<?php echo CHtml::submitButton(Yii::t('cmp','Sure'),array('class'=>'mem_btn mem_btn18','name'=>'delivery'))?>
						</li>
					</ul>
				<?php $this->endWidget(); ?>
			</div>
			<div class="tab_cont2">
				<?php $form=$this->beginWidget('CActiveForm', array(
					'id'=>'order-form2',
					'enableAjaxValidation'=>false,
				)); ?>
					<?php echo $form->hiddenField($model,'zo_id')?>
					<?php echo $form->hiddenField($model,'zo_trx_addid',array('class'=>'trx_address'))?>
					<?php echo $form->hiddenField($model,'zo_sent_addid',array('class'=>'sent_address'))?>
				<p class="fs_14">如果该物品无需物流运送，您可以点击
					 <?php echo CHtml::submitButton(Yii::t('cmp','Sure'),array('class'=>'mem_btn mem_btn18','name'=>'nologistics'))?>
				</p>	
				<?php $this->endWidget(); ?>
			</div>
		</div>
	</div>
</div>
<!--第三步 end-->

</div>
<script type="text/javascript">
$(function(){
	$('#tabAds').TabADS2();
});

function changeAddress(source){
	art.dialog({
	    title: '修改地址',
	    okValue:'确认',
	    cancelValue:'取消',
	    width: 230,
	    height: 100,
	    fixed: true,
	    content: '<?php echo $str?>',
	    ok: function () {
	        $('.'+source+'_address').val($('.cmpaddress:checked').val());
	        $('#address_'+source).text('我选择的地址信息： '+$('.cmpaddress:checked').next('span').text());alert( $('#address_'+source).text());
	        return true;
	    },
	    cancel: function () {
	    	return true;
	    }
	});
}				
</script>

 <!-- 表单验证 -->
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl;?>/js/formvalidata/formValidator-4.1.1.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl;?>/js/formvalidata/formValidatorRegex.js"></script>
 <script>
	jQuery(document).ready(function($) {
		$('#tabAds').TabADS2();
		$.formValidator.initConfig({theme:"126",formID:"payment-form",
			onError:function(msg, obj){
						alert(msg);
						return false;
					},
			onsuccess:function(){ return true; }
		});
	})
</script>
<script type="text/javascript" src="<?php echo Yii::app()->baseUrl;?>/js/formvalidata/cmpValidate.js"></script> 